﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using MySoftWare.Component.Tools.Utils;

namespace MySoftWare.SimpleMVC.Controllers
{
    public class HomeController : Controller
    {
        ///added by lqm 2013.06.19  还待测试 
        ///做一个简单的请求处理，不做返回。每隔一定时间来请求，防止登录用户失效
        [MyHandleError]
        public ActionResult IndexReflesh()
        {
            try
            {
                throw new Exception("oh shit!");
                return new JsonResult()
                {
                    Data = new List<string>() { "fuck", "shit" },
                    JsonRequestBehavior = JsonRequestBehavior.AllowGet
                };
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private static readonly log4net.ILog log = log4net.LogManager.GetLogger("Loggering");
        [Authentication]
        public ActionResult Index()
        {
             ViewBag.Message = "欢迎使用 ASP.NET MVC!";
            //try
            //{
            //    string commandtext = "SELECT * FROM Users";
            //    DataTable dt = DBHelper.ExecuteDataTable(commandtext);
            //    log.Info("log日志信息");
            //    log.Debug("debug信息");
            //    log.Error("error信息");
            //    log.Warn("warn信息");
            //    Exception ex = new Exception("测试的异常信息");
            //    log.Fatal("fatal信息", ex);
            //}
            //catch (Exception e)
            //{
            //    throw e;
            //}
            ///http://www.miniui.com/demo/#src=tree/checkboxtree.html
            /// http://www.jeasyui.com/index.php
            return View();
        }

        public ActionResult About()
        {
            return View();
        }
    }
}
